﻿using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Media;
using System.Windows.Shapes;
using System.Collections.ObjectModel;
using System.Collections.Generic;
using System.Xml.Serialization;

namespace SpyTxT
{
    [Serializable]
    public class AreaCity
    {
        [XmlText]
        public string areacity{get;set;}

        public override string ToString()
        {
            return areacity;
        }
    }
    [Serializable]
    public class Area
    {
        [XmlAttributeAttribute("name")]
        public string name{get;set;}

        [XmlElement("areacity", Type = typeof(AreaCity))]
        public List<AreaCity> areacitylist{get;set;}

      

        public override string ToString()
        {
            return name;
        }

     
        
    }
    [Serializable]
    public class AreaList 
    {
        [XmlElement("area", Type = typeof(Area))]
        public List<Area> arealist{get;set;}

        public Boolean FindCity(string name)
        {
            foreach (Area a in arealist)
            {
                if (a.name == name)
                {
                    return true;
                }
            }
            return false;
        }

        
    }

    [Serializable]
    [XmlRoot("mylist")]
    public class MyAreaList
    {
        [XmlElement("areaList")]
        public AreaList list;

    }

    public class AreaCityListTree : ObservableCollection<Area>
    {
        public AreaCityListTree()
        {

        }
    }

 

    


    
}